﻿<html>

<head>
    <meta charset="utf-8">

    <title>后台登录</title>
    <script src="./js/jquery-1.10.2.min.js"></script>
    <script src="./js/jquery.cookie.js"></script>
    <script src="./constant/common.js"></script>
    <script src="./constant/constant.js"></script>
    <script src="./js/prop-types.js"></script>
    <script src="./js/MD5.js"></script>
    <script src="./js/bootstrap.min.js"></script>
    <script src="./js/react/react.development.js"></script>
    <script src="./js/react/react-dom.development.js"></script>
    <script src="./js/vConsole.js"></script>
    <link href="./css/common.css" rel="stylesheet" type="text/css" />
    <link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <meta name="viewport"
          content="width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1" />
          <meta name="apple-mobile-web-app-capable" content="yes">
          <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
          <meta name="format-detection" content="telephone=no">
      <meta name="renderer" content="webkit" />
      <meta name="force-rendering" content="webkit" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
      <meta name="msapplication-tap-highlight" content="no">
      <meta name="full-screen" content="yes" />
      <meta name="x5-fullscreen" content="true" />
      <meta name="360-fullscreen" content="true" />
      <meta name="screen-orientation" content="portrait" />
      <meta name="x5-orientation" content="portrait">
      <!--<meta name="browsermode" content="application">-->
      <meta name="x5-page-mode" content="app">
    <style>
        .title{
            font-size: 18pt;
            margin-bottom: 5vh;
        }
        .input-group{
            margin-bottom: 3vh;
        }
       
        .alertarea{
            position: absolute;
            width: 100vw;  
        }


    </style>

</head>

<body>
    <!-- <div class='container'></div> -->
            
            <div class="alertarea">

            </div>
           
    <div class="global_center c">
        <div class="center title">
        </div>
        <div class="input-group w40">
            <span class="input-group-addon">用户</span>
            <input placeholder="请输入用户名" type="text" class="name form-control" />
        </div>
        <div class="input-group w40">
                <span class="input-group-addon">密码</span>
            <input placeholder="请输入密码" type="password" class="pwd form-control" />
        </div>

        <div class="center">
            <button id='login' class="btn btn-primary w40" >登录</button>
        </div>

        <div className="input-group input-group ">
            <span className="input-group-addon desc">上传图片</span>
            <input type='file' id='file'  />
            <div className='img_warp'>
                    <!-- <img src={Constant.CLOTH} className="img-responsive" alt="Cinque Terre" width="304" height="236" />  -->
            </div>
    </div>
        

</body>
<script>


var name = '';
var pwd = '';



$(document).ready(function(){
  

    $('#login').click(function(){
        var name = $('.name').val()||"";
        var pwd = $('.pwd').val()||"";
        if(name.length==0||pwd.length==0){
                showAlert($('.alertarea'),'账号或密码错误。','alfail','danger')
        }else{
            $('#alfail').hide();
            var pwd = md5(pwd+Constant.SALT);
            backlogin(name,pwd,succ=>{
                var data = JSON.parse(succ);
                if(data.issuccess==1){
                    $.cookie('token',data.Token);
                  //  window.location.href='main.html';
                    
                }
            })
        }
    })

    $('#check').click(function(){
            console.log($.cookie('token'));
            checklogin(succ=>{
             console.log(succ);
             
            })
  
})
})

        </script>
</html>